package org.taobao.ibatiside.core.filemodel;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;

public class IbatisProject extends IbatisElement {
	private final IProject project;
	private final int version;
	private final IPath outputLocation;
	public IbatisProject(IProject project, int libraryVersion) {
		super();
		this.project = project;
		this.version = libraryVersion;
		outputLocation = KnowOutLocation(project);
	}
	private IPath KnowOutLocation(IProject javaProject) {
		IJavaProject p = JavaCore.create(javaProject);
		try {
			return p.getOutputLocation();
		} catch (JavaModelException e) {
			e.printStackTrace();
		}
		return null;
	}
	public IPath getOutputLocation() {
		return outputLocation;
	}
	
	public IProject getProject() {
		return project;
	}
	
	public int getVersion() {
		return version;
	}
	@Override
	public IResource getResource() {
		return this.project;
	}
}
